<template>
	<div>
		<h1>{{msg}}</h1>
		<br><br>
		<div>
			用户名：
			<Input v-model="username" placeholder="请输入用户名" style="width: 300px"></Input>
			<br>
			<br>
			密&nbsp;&nbsp;&nbsp;码：
			<Input v-model="password" type="password" placeholder="请输入密码" style="width: 300px"></Input>
			<br>
			<br>
			<br>
			<Button type="primary" @click="submit">登录</Button>
		</div>
	</div>
</template>

<script>
	import axios from 'axios'
	export default {
		name: 'page1',
		data () {
			return {
				msg: '测试跨域',
				username: 'admin',
				password: 'admin'
			}
		},
		methods: {
			submit () {

				let fd = new FormData();

				let param = {
				  manageAccount: this.username,
				  managePassword: this.password
				};

				for (let o in param) {
				  fd.append(o, param[o])
				}

				axios.post('http://47.100.4.239:8098/manage/toLogin',fd)
			  .then((response) => {
			    if (response.data.code == 200) {
			    	this.$Notice.success({title: '登录成功！'});
			    } else {
			    	this.$Notice.error({title: res.data.msg});
			    }
			  })
			  .catch((error) => {
			    console.log(error);
			  });
			}
		}
	}
</script>